package com.edu.dao;

import com.edu.entity.Student;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

public interface StudentMapper {

    /*1. 由同学来完成.. */
    String FIELDS = "username,password,tel,email,stuNum,nickName,createDate";
    String VALUES = "#{username},#{password},#{tel},#{email},#{stuNum},#{nickName},now()";
    @Insert("INSERT INTO t_student("+ FIELDS +") VALUES("+ VALUES +")")
    @Options(keyProperty="id",keyColumn="id",useGeneratedKeys=true)
    int addStudent(Student student);

    @Select("select * from t_student where username=#{username}")
    Student getStudentByName(String username);

    /*3. 由同学来完成.. */
    List<Student> queryList(Map<String, String> param);

}